<?php
/*========================================= JooSam =========================================/
/																							/
/	Extention:		JooSam																	/
/	Created by:		Broadcastweb.eu - Paules												/
/	Site:			http://www.broadcastweb.eu												/
/	Email:			support@broadcastweb.eu													/
/	Copyright:		2011 - 2012 (c) Broadcastweb.eu											/
/	License:		CC BY-NC-ND 3.0 ~ http://creativecommons.org/licenses/by-nc-nd/3.0/		/
/	File Version:	0003																	/
/																							/
/========================================== JooSam ========================================*/
// Joomla Security
defined('_JEXEC') or die;
jimport('joomla.application.component.controller');

// JooSam main controller
class JooSamController extends JController{
	
public function display($cachable = false, $urlparams = false){
		
		// Start helpers
		JooSamHelper::addSubmenu(JRequest::getCmd('view', 'joosam'));
		JooSamHelper::backwork();

		// Security
		$view	= JRequest::getCmd('view', 'joosam');
		$layout = JRequest::getCmd('layout', 'default');
		$id		= JRequest::getInt('id');
		$editview = 'com_joosam.edit.'.$view;
		if(($view == 'server' || $view == 'reqevt' || $view == 'textcode') && $layout == 'edit' && !$this->checkEditId($editview, $id)){
			// Somehow the person just went to the form - we don't allow that.
			$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
			$this->setMessage($this->getError(), 'error');
			$this->setRedirect(JRoute::_('index.php?option=com_joosam&view=joosam', false));
			return false;
		}
		parent::display();
		return $this;
	}
}